package com.ace3l.legal.backend.domain;

//import com.ace3l.manager.forms.StudentForm;
//import com.ace3l.manager.util.ManagerConstants;

import java.util.List;
import java.util.ArrayList;
import javax.persistence.*;
import org.apache.commons.lang.StringUtils;

/**
 * ACE3L.COM
 * com.ace3l.manager.domain
 * This code was written by Synesthesia Consulting Services in conjunction
 * with Ace3L.com. This code is confidential and proprietary. This code is
 * copyright (C) 2008  Synesthesia Consulting Services and Ace3L.com
 * Created By: ageer
 * Date: Jun 14, 2008
 * Time: 8:48:21 PM
 */
@Entity
@Table(name ="STUDENT")
@org.hibernate.annotations.GenericGenerator(
    name = "hibernate-increment",
    strategy = "increment"
)
@NamedQueries({
    @NamedQuery(name="studnet.byusername",query="from Student s where s = :username"),
    @NamedQuery(name="student.byid",query="from Student s where s.user.id = :id"),
    @NamedQuery(name="student.byid.abridged",query="select id, firstName, lastName from Student s where s.user.id = :id")
})
public class Student {
    @Id
    @Column(name = "USER_ID")
    private Integer id;

    @OneToOne()
    @PrimaryKeyJoinColumn(name = "USER_ID")
    private User user;
    
    private String firstName;
    private String middleName;
    private String lastName;
    private String mailAddress1;
    private String mailAddress2;
    private String mailCity;
    private String mailState;
    private String mailZip;
    private String contactPhone;
    private String email;
    private Boolean emailVerified;
    private String lawSchoolName;
    private String lawSchoolYear;
    private String lawSchoolGPA;
//    private List adminNotes = new ArrayList();
    private String studentStatus;

//    public void populateFromForm(StudentForm s, User u) {
//        this.firstName = s.getFirstName();
//        this.middleName = s.getMiddleName();
//        this.lastName = s.getLastName();
//        this.mailAddress1 = s.getMailAddress1();
//        this.mailAddress2 = s.getMailAddress2();
//        this.mailCity = s.getMailCity();
//        this.mailState = s.getMailState();
//        this.mailZip = s.getMailZip();
//        this.contactPhone = s.getContactPhone();
//        this.email = s.getEmail();
//        this.lawSchoolName = s.getLawSchoolName();
//        this.lawSchoolYear = s.getLawSchoolYear();
//        this.lawSchoolGPA = s.getLawSchoolGPA();
//        this.studentStatus = ManagerConstants.STUDENT_WORKFLOW_NEW;
//        this.user = u;
//        this.emailVerified = Boolean.FALSE;
//
//    }
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
        this.id = user.getId();
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getMiddleName() {
        return middleName;
    }

    public void setMiddleName(String middleName) {
        this.middleName = middleName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getFullName() {
        if (StringUtils.isBlank(middleName)) return firstName + " " + lastName;
        else return firstName + " " + middleName + " " + lastName;
    }
    public String getMailAddress1() {
        return mailAddress1;
    }

    public void setMailAddress1(String mailAddress1) {
        this.mailAddress1 = mailAddress1;
    }

    public String getMailAddress2() {
        return mailAddress2;
    }

    public void setMailAddress2(String mailAddress2) {
        this.mailAddress2 = mailAddress2;
    }

    public String getMailCity() {
        return mailCity;
    }

    public void setMailCity(String mailCity) {
        this.mailCity = mailCity;
    }

    public String getMailState() {
        return mailState;
    }

    public void setMailState(String mailState) {
        this.mailState = mailState;
    }

    public String getMailZip() {
        return mailZip;
    }

    public void setMailZip(String mailZip) {
        this.mailZip = mailZip;
    }

    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Boolean getEmailVerified() {
        return emailVerified;
    }

    public void setEmailVerified(Boolean emailVerified) {
        this.emailVerified = emailVerified;
    }

    public String getLawSchoolName() {
        return lawSchoolName;
    }

    public void setLawSchoolName(String lawSchoolName) {
        this.lawSchoolName = lawSchoolName;
    }

    public String getLawSchoolYear() {
        return lawSchoolYear;
    }

    public void setLawSchoolYear(String lawSchoolYear) {
        this.lawSchoolYear = lawSchoolYear;
    }

    public String getLawSchoolGPA() {
        return lawSchoolGPA;
    }

    public void setLawSchoolGPA(String lawSchoolGPA) {
        this.lawSchoolGPA = lawSchoolGPA;
    }

//    public List getAdminNotes() {
//        return adminNotes;
//    }
//
//    public void setAdminNotes(List adminNotes) {
//        this.adminNotes = adminNotes;
//    }
//
//    public void addAdminNote(Note newNote) {
//        newNote.setUser(this.getUser());
//        newNote.setIndexId(this.getAdminNotes().size());
//        adminNotes.add(newNote);
//
//    }
    public String getStudentStatus() {
        return studentStatus;
    }

    public void setStudentStatus(String studentStatus) {
        this.studentStatus = studentStatus;
    }
}
